package com.neucloud.da.edgeside.model.exception;

/**
 * 错误编码定义
 * @author HanYu
 */
public class ErrorCode {

    /**
     * 成功
     */
    public static final int SUCCESS_CODE = 200;
    public static final String SUCCESS_MSG = "success";

    /**
     * 异常
     */
    public static final int EXCEPTION_CODE = 1000;

    public static final int FILE_CHUNK_RPC_ERROR = 23001;
    public static final String FILE_CHUNK_RPC_ERROR_MSG = "服务端内部错误";
    public static final int FILE_CHUNK_NOT_EXIST = 23002;
    public static final String FILE_CHUNK_NOT_EXIST_MSG = "文件不存在";
    public static final int FILE_NOT_EXIST = 23003;
    public static final String FILE_NOT_EXIST_MSG = "文件或文件夹不存在";

    public static final int FILE_NAME_ALREADY_EXIST = 23004;
    public static final String FILE_NAME_ALREADY_EXIST_MSG = "文件或文件夹名称不存在";

    public static final int FILE_CHUNK_REST_ERROR = 23020;
    public static final String FILE_CHUNK_REST_ERROR_MSG = "API内部错误";
    public static final int FILE_CHUNK_OSS_ERROR = 23030;

    public static final int DATA_OBJECT_NOT_EXIST_ERROR = 55005;
    public static final String DATA_OBJECT_NOT_EXIST_ERROR_MSG = "数据对象不存在";

    public static final int DATA_OBJECT_UPDATE_ERROR = 55008;
    public static final String DATA_OBJECT_UPDATE_ERROR_MSG = "数据对象更新失败";

    /**
     * 创建文件
     */
    public static final int FILE_CREATE_ERROR = 440001;
    public static final String FILE_CREATE_ERROR_MSG = "创建文件失败";

    public static final int FILE_CREATE_EXIST_ERROR = 440002;
    public static final String FILE_CREATE_EXIST_ERROR_MSG = "文件或文件夹已经存在，请重命名。";

    public static final int FILE_COPY_ERROR = 440003;

    public static final int FILE_MOVE_ERROR = 440004;
    public static final String FILE_MOVE_ERROR_MSG = "文件移动失败";

    public static final int FILE_DRAG_ERROR = 440005;
    public static final String FILE_DRAG_ERROR_MSG = "文件拖拽失败";

    public static final int FILE_DELETE_ERROR = 440006;
    public static final String FILE_DELETE_ERROR_MSG = "文件删除失败";

    public static final int FILE_PREVIEW_EXT_ERROR = 440007;
    public static final String FILE_PREVIEW_EXT_ERROR_MSG = "不支持【%s】文件类型的预览";

    public static final int FILE_PREVIEW_ERROR = 440008;
    public static final String FILE_PREVIEW_ERROR_MSG = "文件预览失败";

    /**
     * 是否为成功
     */
    public static boolean isSuccess(int code) {
        return code == SUCCESS_CODE;
    }
}
